﻿using System;
using System.Collections.ObjectModel;
using SharpShare.Storage;

namespace SharpShare {
    public enum ShareServiceState {
        Invalid = 0,
        Starting,
        Stopped,
        Running,
        ShuttingDown
    }

    public interface IShareService {
        event EventHandler<ShareSessionEventArgs> SessionCreated;
        event EventHandler<ShareSessionEventArgs> SessionEnded;

        void Start();
        void Stop();

        ShareServiceState State { get; }

        string Name { get; }

        ReadOnlyCollection<IStorageProvider> Shares { get; }

        void AddShare(IStorageProvider share);

        void RemoveShare(IStorageProvider share);

        ReadOnlyCollection<IShareSession> Sessions { get; }
    }

    public sealed class ShareSessionEventArgs : EventArgs {
        public ShareSessionEventArgs(IShareSession session) {
            this.Session = session;
        }

        public IShareSession Session { get; private set; }
    }
}
